package com.dawn.common.utils;

/**
 * ClassName: UserThreadLocal
 * Description:
 * Author: yzh
 * Create 2025/6/29 14:38
 * Version: 1.0
 */
public class UserThreadLocal {
    private final static ThreadLocal<Integer> USER = new ThreadLocal<>();
    /**
     * 添加用户
     * @param userId
     */
    public static void  setUser(Integer userId){
        USER.set(userId);
    }
    /**
     * 获取用户
     */
    public static Integer getUser(){
        return USER.get();
    }
    /**
     * 清理用户
     */
    public static void clear(){
        USER.remove();
    }
}
